<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        new Promise((res, rej) => {
            setTimeout(() => {
                res('一秒后执行')
            }, 1000)
        }).then(res => {
            console.log(res)
        })
        function wait(n) {
            return new Promise((res, rej) => {
                setTimeout(() => {
                    res('滚')
                }, n)
            })
        }
        wait(1000).then(res => {
            console.log(res + '一秒执行')
            return wait(2000)
        }).then(res => {
            console.log(res + '两秒执行')
        })
    </script>
</body>

</html>